package com.xmcowell.sportpacemaster.utils;

import android.content.Context;

import com.xmcowell.sportpacemaster.config.Contents;
import com.xmcowell.sportpacemaster.config.Type;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/8/21 0021.
 */

public class MainDataUtil {


    /**
     * 获取首页速度的刻度列表
     * @param context
     * @return
     */
    public static ArrayList<String> generateListSpeed(Context context) {
        ArrayList<String> listSpeed = new ArrayList<>();
        //根据公英制获取不同的最大值
        int SPEED_MAX = Contents.getMaxSpeed(Contents.getUnit(context));
        int count = (int) Math.ceil(SPEED_MAX * 1.0 / 10) + 1;
        for (int i = 0; i < count; i++) {
            listSpeed.add(String.valueOf(i));
        }
        return listSpeed;
    }

    /**
     * 获取首页坡度的刻度列表
     * @param context
     * @return
     */
    public static ArrayList<String> generateListSlope(Context context){
        ArrayList<String> listSlope = new ArrayList<>();
        if (Contents.SPORT_TYPE.equals(Type.PM810)) {
            for (int i = 0; i <= 15; i++) {
                listSlope.add(String.valueOf(i));
            }
        } else if (Contents.SPORT_TYPE.equals(Type.PM940)) {
            for (int i = -3; i <= 18; i++) {
                listSlope.add(String.valueOf(i));
            }
        } else {
            for (int i = -3; i <= 15; i++) {
                listSlope.add(String.valueOf(i));
            }
        }
        return listSlope;
    }
}
